<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="">
  <meta name="format-detection" content="telephone=no">
  <meta name="full-screen" content="yes">
  <meta name="x5-page-mode" content="app">
  <meta name="x5-fullscreen" content="true">
  <meta name="browsermode" content="application">
  <meta content="" name="keywords">
  <meta content="" name="description">
  <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
  <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
  <link rel="stylesheet" href="./js/layer_mobile/need/layer.css">
  <link rel="stylesheet" href="./css/style.css">
  <link rel="stylesheet" href="./iconfont/iconfont.css?ver=1.0">
  <title>我的收入</title>
  <style>
    .iconfont { font-size: 93px; color: #f7c443; }
    .weui-msg__title { font-size: 30px; }
    .weui-msg__title small { font-size: 60%; }
    .tips { font-size: 13px; color: #969696; text-align: left; width: 240px; margin: 10px auto 0; }
    .tips code { font-size: 93%; padding: 2px 4px; color: #c7254e; background-color: #f9f2f4; border-radius: 4px; }
  </style>
</head>
<body>
  <div class="weui-msg">
    <script id='wrap' type='text/html'>
      {{# if(d.status == 2) { }}
      <!-- 代理通过 -->
      <div class="weui-msg__icon-area"><i class="iconfont icon-qian1 weui-icon_msg"></i></div>
      <div class="weui-msg__text-area">
        <p class="weui-msg__desc">账户余额</p>
        <h2 class="weui-msg__title">
          <small>￥</small><span id="money">{{ d.money }}</span>
        </h2>
      </div>
      <a href="./moneyApply.html?pid={{d.id}}" class="weui-btn weui-btn_primary submit-btn">申请提现</a>
      <div class="tips">
        <div>1. 每天仅能提现<code>一次</code>；</div>
        <div>2. 每次提现金额不低于<code>1元</code>；</div>
        <div>3. 每次提现金额不大于<code>1000元</code>。</div>
      </div>
      {{# } else if(d.status == 1 || d.status == 3) { }}
      <!-- 代理申请未处理 -->
      <div class="weui-msg">
        <div class="weui-msg__icon-area"><i class="weui-icon-waiting weui-icon_msg"></i></div>
        <div class="weui-msg__text-area">
          <h2 class="weui-msg__title">您的申请尚未处理</h2>
          <p class="weui-msg__desc">点击下面按钮去<b>查看申请进度</b>吧。</p>
        </div>
        <div class="weui-msg__opr-area">
          <p class="weui-btn-area">
            <a href="proxySpeed.html?pid={{d.data.id}}" class="weui-btn weui-btn_primary">查看申请进度</a>
          </p>
        </div>
      </div>
      {{# } else if(d.status == -9) { }}
      <!-- 其他错误 -->
      <div class="weui-msg">
        <div class="weui-msg__icon-area"><i class="weui-icon-warn weui-icon_msg"></i></div>
        <div class="weui-msg__text-area">
          <h2 class="weui-msg__title">其他错误</h2>
          <p class="weui-msg__desc">您还不是代理，或网络出现错误</p>
        </div>
      </div>
      {{# } }}
    </script>
    <div id="render"></div>

    <div class="weui-msg__extra-area">
      <div class="weui-footer">
        <p class="weui-footer__text">Copyright © 天空文化传播</p>
      </div>
    </div>
  </div>
  <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
  <script src="./js/jquery.waypoints.min.js"></script>
  <script src="./js/jquery.countup.min.js"></script>
  <script src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script>
  <script src="./js/tools2.js?ver=2.1"></script>
  <script src="./js/jweixin-1.4.0.js?ver=1.0"></script>
  <script src="./js/layer_mobile/layer.js"></script>
  <script src="./js/layer_mobile/laytpl.js"></script>
  <script>
    // var vConsole = new VConsole();
    var mid = tools.getItem('userInfo').user_code;   // 用户id
    var wrap = $('#wrap').html();   // layui区域

    $(function() {
      tools.login(function() {
        getSpeed();
      })
    })

    // 获取申请进度
    function getSpeed() {
      tools.ajax({
        url: "/proxy/" + mid,
        success: function(res) {
          if(res.code == 0) {
            laytpl(wrap).render(res.data, function(html) {
              $('#render').html(html);
              $('#money').countUp();
            })
          } else {
            laytpl(wrap).render({ status: -9 }, function(html) {
              $('#render').html(html);
            })
          }
        },
        error: function(err) {
          if(err.status === 403) {
            tools.wxLogin();
          } else {
            laytpl(wrap).render({ status: -9 }, function(html) {
              $('#render').html(html);
            })
          }
        }
      })
    }
    tools.hide();
  </script>
</body>
</html>